{!! Html::style(env("APP_URL").'/assets/backend/admin/css/jquery-ui.min.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/common.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/angular-motion.min.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/order.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/multiselect.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/slideGallery.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/printTemplate.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/aiui.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/admin/css/postil.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/libs/jquery-ui-1.9.2/css/ui-lightness/jquery-ui-1.9.2.custom.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/libs/jqGrid/css/ui.jqgrid.css') !!}
<style type="text/css">
/*固定出现滚动条,以解决滚动条出现后挤压jqgrid列表宽度影响列表样式问题 */
body {
    overflow-y: scroll;
}

/*单元格内容过多时换行*/
.ui-jqgrid tr.jqgrow td {
    white-space: normal !important;
    height: auto;
    vertical-align: middle;
    padding-top: 8px;
    padding-bottom: 8px;
}

/*修复带横向滚动条的jqgrid在firefox下表头对不齐的问题*/
.grid-wrap .ui-jqgrid-view *, .grid-wrap .ui-jqgrid-view *:after, .grid-wrap .ui-jqgrid-view *:before {
    box-sizing: content-box;
}

.data-container {
    display: inline-block;
    border: 1px solid #d7d7d7;
    width: 24.8%;
    margin-bottom: 10px;
    font-size: 12px;
    text-align: center;
    padding-top: 3px;
    padding-bottom: 3px;
    margin-right: 0;
}

.data-container.last-container {
    border-right: 1px solid #d7d7d7;
}

.data-container .title {
    color: #53606b;
    font-size: 14px;
    line-height: 31px;
}

.data-container .text {
    font-size: 24px;
    color: #fe3800;
    margin: 10px;
    line-height: 31px;
}

#pop * {
    margin: 0;
    padding: 0;
}

#pop {
    background: #fff;
    width: 260px;
    border: 1px solid #e0e0e0;
    font-size: 12px;
    position: fixed;
    right: 10px;
    bottom: 10px;
    z-index: 1031
}

#popHead {
    line-height: 32px;
    background: #f6f0f3;
    border-bottom: 1px solid #e0e0e0;
    position: relative;
    font-size: 12px;
    padding: 0 0 0 10px;
}

#popHead h2 {
    font-size: 14px;
    color: #666;
    line-height: 32px;
    height: 32px;
}

#popHead #popClose {
    position: absolute;
    right: 10px;
    top: 1px;
}

#popHead a#popClose:hover {
    color: #f00;
    cursor: pointer;
}

#popContent {
    padding: 5px 10px;
}

#popTitle a {
    line-height: 24px;
    font-size: 14px;
    font-family: '微软雅黑';
    color: #333;
    font-weight: bold;
    text-decoration: none;
}

#popTitle a:hover {
    color: #f60;
}

#popIntro {
    text-indent: 24px;
    line-height: 160%;
    margin: 5px 0;
    color: #666;
}

#popMore {
    text-align: right;
    border-top: 1px dotted #ccc;
    line-height: 24px;
    margin: 8px 0 0 0;
}

#popMore a {
    color: #f60;
}

#popMore a:hover {
    color: #f00;
}
</style>
@include('shop-backend::includes.loading')
<div class="tabs-container" ng-app="JxApp" style="min-height: 500px; display: none">
    <div class="tab-content" ng-controller="SaleReportModule" id="SaleReportModule">
        <div class="single-pannel" style="padding-top:10px;">
            <ul class="nav nav-tabs" id="myTab">
				<li class="active saleRetailList"><a href="#saleRetailList" data-toggle="tab">销售明细</a></li>
				<li class="groupBySkuList"><a href="#groupBySkuList" data-toggle="tab">按单品汇总</a></li>
                {{--<li class="groupByGoodList"><a href="#groupByGoodList" data-toggle="tab">按商品汇总</a></li>--}}
                <li class="groupByOrderList"><a href="#groupByOrderList" data-toggle="tab">按订单汇总</a></li>
				<li class="groupByClientList"><a href="#groupByClientList" data-toggle="tab">按客户汇总</a></li>
				<li class="groupBySalerList"><a href="#groupBySalerList" data-toggle="tab">按销售员汇总</a></li>
				{{--<li class="groupBySalerComStoreList"><a href="#groupBySalerComStoreList" data-toggle="tab">按销售员所属门店汇总</a></li>--}}
			</ul>
            <div class="" style="padding-top:8px;">
                <!-- 销售明细列表 -->
				<div class="tab-pane active" id="saleRetailList">
                    <div>
						<ul class="list-inline sel-a" style="padding-left: 20px">

							<li id="bysearchTab" class="searchTab" style="margin-left:20px;" ng-class="{'searchTab-active':showSearchTab}">
                                <span ng-click="showSearchTab = !showSearchTab;"><span class="glyphicon glyphicon-search">搜索</span></span>
                            </li>
							<li class="li-btn">
                                <button class="btn-normal" ng-click="changeShowDataCount();">
									<span style="color:#fff;" ng-bind="getShowDataCountText();"></span>
                                </button>
                            </li>
                            {{--ng-show="resources.indexOf('saleReportExport') != -1"--}}
                            <li class="li-btn">
                                <button class="btn-normal btn-exportExcel" data-toggle="modal-filter" data-target="#download_modal" data-backdrop="static" data-keyboard="false" data-link="{{route('admin.shop.report.sales.saleDetailListExcel')}}" id="filter-xls" data-url="{{route('admin.export.index',['toggle'=>'filter-xls'])}}" data-type="xls">导出</button>
                            </li>
							<li ng-class="{'text-sel':searchModel.timePeriod == 'today' }" ng-click="searchModel.timePeriod ='today'; searchList();getSumData();">今日</li>
							<li ng-class="{'text-sel':searchModel.timePeriod == 'yesterday' }" ng-click="searchModel.timePeriod ='yesterday'; searchList();getSumData();">昨日</li>
							<li ng-class="{'text-sel':searchModel.timePeriod == 'thisWeek' }" ng-click="searchModel.timePeriod ='thisWeek'; searchList();getSumData();">近7天</li>
							<li ng-class="{'text-sel':searchModel.timePeriod == 'thisMonth' }" ng-click="searchModel.timePeriod ='thisMonth'; searchList();getSumData();">近30天</li>
						</ul>
					</div>
                    <div ng-show="showSearchTab">
                        <form class="form-inline searchForm" role="form" id="searchForm" style="padding-bottom: 0px;">
							<div class="group-item">
								<label>日期：</label>
								<div class="form-group ">
									<div style="width: 215px;">
										<input placeholder="开始日期" style="width: 95px" type="text" class="form-control" datepicker-popup ng-model="searchModel.beginTime" show-weeks=false show-button-bar=false required />&nbsp;至&nbsp;<input placeholder="结束日期" type="text" class="form-control" datepicker-popup style="width: 95px" ng-model="searchModel.endTime" show-weeks=false show-button-bar=false required />
									</div>
								</div>
							</div>
							<div class="group-item" ng-show="isShowSearchItem('searchKey')">
								<label>商品：</label>
								<div class="form-group ">
									<input type="text" name="searchKey" id="searchKey" style="width: 125px;" class="form-control" ng-model="searchModel.searchKey" placeholder="名称、货号">
								</div>
							</div>
							<div class="group-item" ng-show="isShowSearchItem('category')">
								<label>分类：</label>
								<div class="form-group ">
									<select class="form-control" levelsel id="categoryId" loptions="allCategory" ng-model="searchModel.categoryId">
										<option value="">-全部-</option>
									</select>
								</div>
							</div>
							<div class="group-item" ng-show="isShowSearchItem('bland')">
								<label>品牌：</label>
								<div class="form-group ">
									<div style="display: inline-block; vertical-align: middle; width: 110px;">
										<exselect ng-model="searchModel.bland" sel-val="searchModel.blandId" data="blands" datareader="{text:'name',val:'id'}" placeholder="-全部-" exoptions="[{text:'-全部-',val:''}]"></exselect>
									</div>
								</div>
							</div>
                            {{--<div class="group-item" ng-show="isShowSearchItem('client')">
                                <label>客户：</label>
                                <div class="form-group ">
                                    <div style="width: 100px;">
                                        <mulselect ng-model="client" sel-val="searchModel.clientId" dataReader="{val:'id'}" placeholder="-全部-" searchplaceholder="输入客户名称或手机号查询" url="/is/admin/inner/client/clientSelectJSON.ac" exOptions="[{val:'',text:'-全部-'}]"></mulselect>
                                    </div>
                                </div>
                            </div>--}}
                            {{--<div class="group-item" ng-show="isShowSearchItem('storeId')">
                                <label>仓库所属门店：</label>
                                <div class="form-group ">
                                    <div style="width: 100px;">
                                        <mulselect ng-model="storeId" sel-val="searchModel.storeId" exOptions="[{val:'',text:'-全部-'},{val:'0', text:'公共'}]" url="/is/admin/comstore/comStoreSelectListJSON.ac?filterComStore=1" placeholder="-全部-"></mulselect>
                                    </div>
                                </div>
                            </div>--}}

                            {{--<div class="group-item" ng-show="isShowSearchItem('salerComStoreId')">
                                <label>销售员所属门店：</label>
                                <div class="form-group ">
                                    <div style="width: 100px;">
                                        <mulselect ng-model="salerComStoreId" sel-val="searchModel.salerComStoreId" exOptions="[{val:'',text:'-全部-'},{val:'0', text:'公共'}]" url="/is/admin/comstore/comStoreSelectListJSON.ac" placeholder="-全部-"></mulselect>
                                    </div>
                                </div>
                            </div>--}}

                            {{--<div class="group-item" ng-show="isShowSearchItem('handler')">
                                <label>制单人：</label>
                                <div class="form-group ">
                                    <div style="width: 100px;">
                                        <mulselect ng-model="handler" sel-val="searchModel.handlerId" exOptions="[{val:'',text:'-全部-'}]" url="/is/admin/pubuser/userSelectJSON.ac" placeholder="-全部-"></mulselect>
                                    </div>
                                </div>
                            </div>--}}
                            {{--<div class="group-item" ng-show="isShowSearchItem('saler')">
                                <label>销售员：</label>
                                <div class="form-group ">
                                    <div style="width: 100px;">
                                        <mulselect ng-model="saler" sel-val="searchModel.salerId" exOptions="[{val:'',text:'-全部-'}]" url="/is/admin/pubuser/userSelectJSON.ac" placeholder="-全部-"></mulselect>
                                    </div>
                                </div>
                            </div>--}}
                            {{--<div class="group-item" ng-show="isShowSearchItem('color')">
                                <label>颜色：</label>
                                <div class="form-group ">
                                    <div style="display: inline-block; vertical-align: middle; width: 120px;">
                                        <mulselect ng-model="searchColor" sel-val="searchModel.colorIds" url="/is/admin/inner/goods/color/colorListSelectJSON.ac?status=1" datareader="{text:'name',val:'id'}" placeholder="-全部-" exoptions="[{text:'-全部-',val:''}]"></mulselect>
                                    </div>
                                </div>
                            </div>

                            <div class="group-item" ng-show="isShowSearchItem('size')">
                                <label>尺码：</label>
                                <div class="form-group ">
                                    <div style="display: inline-block; vertical-align: middle; width: 120px;">
                                        <mulselect ng-model="searchSize" sel-val="searchModel.sizeIds" url="/is/admin/inner/goods/size/sizeSelectOptionListJSON.ac?status=1" datareader="{text:'name',val:'id'}" placeholder="-全部-" exoptions="[{text:'-全部-',val:''}]"></mulselect>
                                    </div>
                                </div>
                            </div>--}}

                            <div class="group-item" ng-show="isShowSearchItem('color')">
								<label>颜色：</label>
								<div class="form-group ">
									<div style="display: inline-block; vertical-align: middle; width: 120px;">
										<exselect ng-model="searchColor" sel-val="searchModel.colorIds" data="allColorJson" datareader="{text:'name',val:'id'}" placeholder="-请选择-" exoptions="[{text:'-请选择-',val:''}]"></exselect>
									</div>
								</div>
							</div>
							<div class="group-item" ng-show="isShowSearchItem('size')">
								<label>尺码：</label>
								<div class="form-group ">
									<div style="display: inline-block; vertical-align: middle; width: 120px;">
										<exselect ng-model="searchSize" sel-val="searchModel.sizeIds" data="allSizeJson" datareader="{text:'name',val:'id'}" placeholder="-请选择-" exoptions="[{text:'-请选择-',val:''}]"></exselect>
									</div>
								</div>
							</div>

							<div class="group-item" ng-show="isShowSearchItem('style')">
								<label>款式：</label>
								<div class="form-group ">
									<div style="display: inline-block; vertical-align: middle; width: 120px;">
										<exselect ng-model="searchStyle" sel-val="searchModel.styleId" data="allStyleJson" datareader="{text:'name',val:'id'}" placeholder="-全部-" exoptions="[{text:'-全部-',val:''}]"></exselect>
									</div>
								</div>
							</div>

							<div class="group-item" ng-show="isShowSearchItem('year')">
								<label>年份：</label>
								<div class="form-group ">
									<div style="display: inline-block; vertical-align: middle; width: 120px;">
										<exselect ng-model="searchYear" sel-val="searchModel.year" data="allYears" datareader="{text:'name',val:'id'}" placeholder="-全部-" exoptions="[{text:'-全部-',val:''}]"></exselect>
									</div>
								</div>
							</div>

							<div class="group-item" ng-show="isShowSearchItem('season')">
								<label>季节：</label>
								<div class="form-group ">
									<div style="display: inline-block; vertical-align: middle; width: 120px;">
										<exselect ng-model="searchSeason" sel-val="searchModel.seasonId" data="seasons" datareader="{text:'name',val:'id'}" placeholder="-全部-" exoptions="[{text:'-全部-',val:''}]"></exselect>
									</div>
								</div>
							</div>
							<div class="group-item" ng-show="isShowSearchItem('ordersSn')">
								<label>单号：</label>
								<div class="form-group ">
									<input type="text" name="ordersSn" id="ordersSn" style="width: 125px;" class="form-control" ng-model="searchModel.ordersSn" placeholder="请输入单号...">
								</div>
							</div>
                            {{--<div class="group-item" ng-show="isShowSearchItem('businessType')">
                                <label>业务类别：</label>
                                <div class="search-inline-padding" style="display:inline-block;width:110px;">
                                    <select class="form-group form-control" ng-model="searchModel.businessType">
                                        <option value="-1" selected="selected">-全部-</option>
                                        <option value="0">零售</option>
                                        <option value="1">销售</option>
                                        <option value="2">销售退货</option>
                                    </select>
                                </div>
                            </div>--}}
                            {{--<div class="group-item" ng-show="isShowSearchItem('orderStatus')">
                                <label>状态：</label>
                                <div class="search-inline-padding" style="display:inline-block;width:110px;">
                                        <select class="form-group form-control" ng-model="searchModel.orderStatus">
                                        <option value="2" selected="selected">已出售</option>
                                        <option value="1">草稿</option>
                                        <option value="9">撤销</option>
                                        </select>
                                </div>
                            </div>--}}
                            <div class="form-group">
								<button class="btn-normal" type="button" ng-click="searchList();getSumData();" id="searchBtn" style="line-height: 28px; font-size: 12px; height: 28px; vertical-align: middle;">查询</button>
							</div>
						</form>
                    </div>
                    <div ng-show="showCountData">
						<div class="data-container">
							<span class="title">销售单品数</span>
							<span class="title" ng-show="sumDataLoading">&nbsp;&nbsp;查询中...</span>
							<span class="text" ng-bind="sumQuantity" ng-show="!sumDataLoading"></span>
						</div>
						<div class="data-container">
							<span class="title">销售额</span>
							<span class="title" ng-show="sumDataLoading">&nbsp;&nbsp;查询中...</span>
							<span class="text" ng-bind="sumTrueAmount|currency:'￥'" ng-show="!sumDataLoading"></span>
						</div>
						<div class="data-container">
							<span class="title">销售毛利</span>
							<span class="title" ng-show="sumDataLoading">&nbsp;&nbsp;查询中...</span>
							<span class="text" ng-bind="sumGrossProfit|currency:'￥'" ng-show="!sumDataLoading"></span>
						</div>
						<div class="data-container last-container">
							<span class="title">销售毛利率(%)</span>
							<span class="title" ng-show="sumDataLoading">&nbsp;&nbsp;查询中...</span>
							<span class="text" ng-bind="avgGrossProfitRate" ng-show="!sumDataLoading"></span>
						</div>
					</div>
                    <div class="grid-wrap">
						<table id="list_section"></table>
						<div id="list_section_pager" class="grid-pager"></div>
					</div>
                </div>
            </div>
        </div>
        <!-- 内容容器 end -->
        <!-- 等候提示框 -->
		<div id="waitingDialog">
			<div class="text-center loadding bills ">
				<span ng-bind="waitingTips"></span>
			</div>
		</div>
    </div>
    <div id="download_modal" class="modal inmodal fade"></div>
</div>
<script>
    var base = '{{ env('APP_URL') }}';
    var allCategory = {!! json_encode($allCategories) !!};
    var allCategoryList = {!! json_encode($categories) !!};
    var strBlandListJson = {!! json_encode($brandList) !!};
    var strSeasonListJson = {!! json_encode($seasons) !!};
    var strStyleListJson = {!! json_encode($styles) !!};
    var allYears = {!! json_encode($years) !!};
    var allSizes = {!! json_encode($sizes) !!};
    var allColors = {!! json_encode($colors) !!};

    $('#userId').select2({
	    placeholder: "请选择",
	    allowCreate: true
    });

    /**
     * 右下角弹窗函数,默认3秒后消隐,消隐将历时0.5s.
     * @param title 标题
     * @param content 内容
     */
    function showMessage(title, content) {
	    var options = {};
	    $("#popTitle").html(title);
	    $("#popIntro").html(content);
	    $("#pop").show("slow", closeMessage(3000));
    }

    /**
     * 右下角弹窗关闭函数
     */
    function closeMessage(timeout) {
	    if (timeout && timeout > 0) {
		    setTimeout(function () {
			    $("#pop:visible").removeAttr("style").fadeOut(500);
		    }, timeout);
	    }
    }
</script>
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-animate.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-resource.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-sanitize.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/ng-currency.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-cookie.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-locale_zh-cn.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/ui-bootstrap-tpls-0.10.0.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-strap.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/angular-strap.tpl.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/mulselect.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/service.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/checklist-model.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/admin/js/jui-select.js') !!}

{!! Html::script(env("APP_URL").'/assets/backend/libs/jqGrid/js/i18n/grid.locale-cn.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/libs/jqGrid/js/jquery.jqGrid.min.js') !!}
{!! Html::script(env("APP_URL").'/assets/backend/libs/jquery-ui-1.9.2/js/jquery-ui-1.9.2.custom.js') !!}
@include('shop-backend::includes.loading-script')
@include('shop-backend::purchase.includes.common')
@include('shop-backend::stockRecord.mulselect')
@include('shop-backend::stockQuery.levelselect')
@include('shop-backend::sales.saleReport')